package com.csu.petstore.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.math.BigDecimal;

@Data
@TableName("CartItem")
public class CartItem {
    @TableField(exist = false)
    private Item item;
    @TableField("userid")
    private String userId;
    @TableId("itemid")
    private String itemId;
    @TableField("linenum")
    private int lineNumber;
    private String attr;
    @TableField("productid")
    private String productId;
    private int quantity;
    @TableField("isinstock")
    private boolean inStock;
    @TableField("listprice")
    private BigDecimal listPrice;
    @TableField("unitprice")
    private BigDecimal unitPrice;
    @TableField(exist = false)
    private BigDecimal total;
    public BigDecimal getTotal() {
        BigDecimal Total = listPrice.multiply(BigDecimal.valueOf(quantity));
        return Total;
    }
}
